package com.hbean.system.init;

import com.hbean.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @Description: 系统初始化
 * 项目启动时加载信息
 * @Project: hbean
 * @Author: hjibo
 * @CreateDate: 2018-09-29 18:23
 * @ModificationHistory:
 */

@Slf4j
@Component
@Order(999)
public class SysInit implements CommandLineRunner {

    @Autowired
    private SysDicService sysDicService;
    @Autowired
    private SysUserService sysUserService;
    @Autowired
    private SysRoleService sysRoleService;
    @Autowired
    private SysUserRoleService sysUserRoleService;
    @Autowired
    private SysMenuService sysMenuService;
    @Autowired
    private SysRoleMenuService sysRoleMenuService;



    @Override
    public void run(String... args) throws Exception {
        log.info("###### 加载系统字典信息 ######");
        this.sysDicService.getDataForCache();
        log.info("###### 加载系统用户信息 ######");
        this.sysUserService.getDataForCache();
        log.info("###### 加载系统角色信息 ######");
        this.sysRoleService.getDataForCache();
        log.info("###### 加载系统用户-角色信息 ######");
        this.sysUserRoleService.getDataForCache();
        log.info("###### 加载系统菜单信息 ######");
        this.sysMenuService.getDataForCache();
        log.info("###### 加载系统角色-菜单信息 ######");
        this.sysRoleMenuService.getDataForCache();


    }
}
